// All links-related publications

import { Meteor } from 'meteor/meteor';

Meteor.publish("users.list", function (page, pagesize) {
    return Meteor.users.find({}, {skip: page*pagesize, limit: pagesize, sort: {createdAt: -1}, 
    	fields: {'role_ids': 1, 'profile': 1, 'username': 1, 'createdAt': 1, 'isBanned': 1}});
});
Meteor.publish("MobileUserName", function (mobile) {
    // console.log(Meteor.users.find({profile: {mobile: mobile}}).fetch());
    return Meteor.users.find({profile: {mobile: mobile}});
});

Meteor.publish("currentUserData", function () {
  if (this.userId) {
      return Meteor.users.find({_id: this.userId},
                               {fields: {'role_ids': 1, 'profile': 1, 'username': 1, 'createdAt': 1, 'isBanned': 1}});
    } else {
      this.ready();
    }
});
